<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <body>

        <ui:composition >

            <p:panel >
                <h:panelGrid columns="2" >
                    <p:commandButton id="btnSalvar" 
                                     value="Salvar F10" 
                                     icon="iconSalvar"
                                     action="#{musicaBean.salvar()}"
                                     update=":geral,:geral:mensagem, :geral:pnlProcesso"
                                     />
                    <p:commandButton value="Voltar Esc"
                                     id="btnVoltar"
                                     action="#{musicaBean.voltar()}"
                                     icon="iconFechar"
                                     update=":geral:pnlProcesso, :geral:mensagem"/>
                </h:panelGrid>
            </p:panel>
            <h:panelGrid columns="2">

                <h:outputLabel for="nome" value="Nome do Musica: *"/>
                <p:inputText id="nomeMusica" value="#{musicaBean.musica.nomeMusica}" label="Nome" size="30"/>
                <h:outputLabel for="nome" value="Faixa: *"/>
                <p:inputText id="faixa" value="#{musicaBean.musica.faixa}" label="Faixa" size="7"/>
                <h:outputLabel for="nome" value="Artista:"/>
                <p:selectOneMenu 
                    id="artista"
                    label="#{musicaBean.musica.artistaid.nomeArtista}" 
                    value="#{musicaBean.musica.artistaid}" 
                    style="width: 200px; height: auto">
                    <f:selectItems value="#{musicaBean.artistas}"/>
                    <f:converter converterId="ArtistaConversor"/>
                </p:selectOneMenu>
                <h:outputLabel for="nome" value="Compositor:"/>
                <p:selectOneMenu 
                    id="compositor"
                    label="#{musicaBean.musica.compositorId.nomeCompositor}" 
                    value="#{musicaBean.musica.compositorId}" 
                    style="width: 200px; height: auto">
                    <f:selectItems value="#{musicaBean.compositores}"/>
                    <f:converter converterId="CompositorConversor"/>
                </p:selectOneMenu> 
                <h:outputLabel for="nome" value="Gênero Musical:"/>
                <p:selectOneMenu 
                    id="generoMusical"
                    label="#{musicaBean.musica.estiloMusicalid.nomeGeneroMusical}" 
                    value="#{musicaBean.musica.estiloMusicalid}" 
                    style="width: 200px; height: auto">
                    <f:selectItems value="#{musicaBean.generosMusicais}"/>
                    <f:converter converterId="GeneroMusicalConversor"/>
                </p:selectOneMenu>
                <h:outputText value="Adicionar Música: " />
                <p:fileUpload id="upload"
                              fileUploadListener="#{musicaBean.uploadMusica}"
                              auto="true"
                              label="Buscar...">

                </p:fileUpload> 
                <p:message id="erroFoto" for="upload"/>

            </h:panelGrid>

        </ui:composition>

    </body>
</html>